using FluentAssertions;
using Xunit;

namespace Sustainalytics.ScreeningTool.Synchronization.Tests.Extensions.StringExtensionsTests
{
    [Trait("Category", "Unit")]
    public class JoinStrings_Should
    {
        [Fact]
        public void return_null_for_null_sequence()
            => ((string[])null).JoinStrings(";").Should().Be(null);

        [Fact]
        public void return_null_for_empty_sequence()
            => new string[0].JoinStrings(";").Should().Be(null);

        [Fact]
        public void return_item_if_sequence_has_only_1_item()
            => new[] { "bla" }.JoinStrings(";").Should().Be("bla");

        [Fact]
        public void return_concatenated_items_separated_by_separator()
            => new[] { "a", "b", "c" }.JoinStrings(";").Should().Be("a;b;c");

        [Fact]
        public void return_concatenated_items_if_separator_is_default()
            => new[] { "a", "b", "c" }.JoinStrings().Should().Be("abc");

        [Fact]
        public void skip_empty_values_when_concatenating_items()
            => new[] { " ", "a", "b", " ", " ", "c", " " }.JoinStrings(",").Should().Be("a,b,c");
    }
}
